import { ADD, MINUS } from './constans'

let init = {
  count: 1
};
function reducer(state = init, action) {
  if (action.type === ADD) {
    return { ...state, count: state.count + action.payload };
  }
  if (action.type === MINUS) {
    return { ...state, count: state.count - action.payload };
  }
  return state;
}

export default reducer;